package org.activemonitoring.datastore.jms.client;

import javax.annotation.Resource;

import org.activemonitoring.datastore.DataStore;
import org.activemonitoring.domain.Measures;
import org.apache.log4j.Logger;
import org.springframework.jms.core.JmsTemplate;

public class DataStoreJmsClient implements DataStore {

    private static final Logger logger = Logger.getLogger(DataStoreJmsClient.class);

    @Resource
    private JmsTemplate template;

    public DataStoreJmsClient() throws Exception {
        super();
    }

    @Override
    public void store(Measures measures) {
        logger.debug("Sending measures through jms");
        this.template.convertAndSend(measures);
    }

    public void setJmsTemplate(JmsTemplate template) {
        this.template = template;
    }
}
